//
//  PersistencyManager.m
//  FTWDemo
//
//  Created by ZYYX on 9/10/14.
//  Copyright (c) 2014 acs. All rights reserved.
//

#import "PersistencyManager.h"


@implementation PersistencyManager
{
    NSMutableArray *coverImages;
}

- (id)init
{
    self = [super init];
    if (self) {
        coverImages = [[NSMutableArray alloc] init];
            }
    return self;
}


-(NSArray*)coverImages
{
    return coverImages;
}

- (void)saveImage:(UIImage*)image filename:(NSString*)filename
{
    filename = [NSHomeDirectory() stringByAppendingFormat:@"/Documents/%@", filename];
    NSData *data = UIImagePNGRepresentation(image);
    [data writeToFile:filename atomically:YES];
}

- (UIImage*)getImage:(NSString*)filename
{
    filename = [NSHomeDirectory() stringByAppendingFormat:@"/Documents/%@", filename];
    NSData *data = [NSData dataWithContentsOfFile:filename];
    return [UIImage imageWithData:data];
}
@end
